package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswProductMail;

@Mapper
public interface TswProductMailDao {

    @Select("select * from tsw_product_mail t where t.id = #{id}")
    TswProductMail getById(Long id);

    @Delete("delete from tsw_product_mail where id = #{id}")
    int delete(Long id);

    int update(TswProductMail tswProductMail);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_product_mail(method, min_postage_free, mail_price, state, whether, receive_area, insurance_price, insurance_information, create_time, creater, update_time, updater, mail_note, mail_remark) values(#{method}, #{minPostageFree}, #{mailPrice}, #{state}, #{whether}, #{receiveArea}, #{insurancePrice}, #{insuranceInformation}, #{createTime}, #{creater}, #{updateTime}, #{updater}, #{mailNote}, #{mailRemark})")
    int save(TswProductMail tswProductMail);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswProductMail> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
